package main

import (
	"fmt"
	"reflect"
	"regexp"
)

func main() {
	re := regexp.MustCompile(`.com`)
	fmt.Println(re.FindString("google.com"))
	fmt.Println(re.FindString("abc.org"))
	fmt.Println(re.FindString("Fb.com"))

	// regex 示例2
	re2 := regexp.MustCompile("f([a-z]+)ing")
	re2_result := re2.FindStringSubmatch("flying")
	fmt.Println(re2_result, reflect.TypeOf(re2_result))
	fmt.Println(re2_result[1])
	fmt.Println(re2.FindStringSubmatch("abcfloatingxyz"))
}
